package com.todo.strategy.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/11/28 02:53
 * @description
 */
@Getter
@AllArgsConstructor
public enum MemoTypeEnum {
    USER(1, "USER", "用户备忘录"),
    PLATFORM_BEFORE(2, "PLATFORM_BEFORE", "平台出行前备忘录"),
    PLATFORM_NOMAL(3, "PLATFORM_NOMAL", "平台日常备忘录"),
    PLATFORM_STAR(4, "PLATFORM_STAR", "平台标星备忘录"),
    ;

    private static Map<Integer, MemoTypeEnum> typeMap = Arrays
            .stream(MemoTypeEnum.values())
            .collect(Collectors.toMap(MemoTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static MemoTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
